﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;

namespace BaseHelper.Encrypt
{
    public class Md5Helper
    {
        public static string Encrypt3th(string password)
        {
            for(int i=0;i<3;i++)
                password = Encrypt(password);
            return password;
        }


        public static string Encrypt(string input)
        {
             
            MD5 md5 = System.Security.Cryptography.MD5.Create();
            byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
            byte[] hashBytes = md5.ComputeHash(inputBytes);
            
            //md5.Dispose();

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < hashBytes.Length; i++)
                sb.Append(hashBytes[i].ToString("X2"));

            return sb.ToString().ToLower();
        }
    }
}
